home *** CD-ROM | disk | FTP | other *** search
- Path: garden.csc.calpoly.edu!not-for-mail
- From: dstubbs@garden.csc.calpoly.edu (Dan Stubbs)
- Newsgroups: comp.lang.c
- Subject: Re: Example of an unintelligible program in C
- Date: 16 Mar 1996 10:16:36 -0800
- Organization: Cal Poly, San Luis Obispo
- Message-ID: <4if0i4$qsm@garden.csc.calpoly.edu>
- References: <4iegj7$evn@bee.uspnet.usp.br>
- NNTP-Posting-User: dstubbs@garden.csc.calpoly.edu
-
- In article <4iegj7$evn@bee.uspnet.usp.br>,
- Carlos Eduardo Dantas de Menezes <menezes@lsi.usp.br> wrote:
- >Please,
- >
- >Could someone give me an example of an (very)
- >unintelligible and short program in C?
- >This question is to show how shouldn't write a
- >program in C (didatic purposes only).
- >Thank you very much!
- >
- >--
- >Carlos Eduardo Dantas de Menezes.
- >ESCOLA POLITECNICA DA UNIVERSIDADE DE SAO PAULO.
- >E-MAIL: menezes@lsi.usp.br
- >URL: http://www.lsi.usp.br/~menezes/menezes.html
- >
- >
-
- Here is one of my favorites. Guess what it does! Apply a formatter
- such as cb or indent to it if you really want to make it obscure.
-
- int S(i){int O,o,I=i,l,_=0;while(I/=
- 4)++_;for(l=(o=O=1<<_)<<_;o/=2;
- )if
- ((I
- =l+
- (O+
- o+O<< --_
- ) ) <=i
- ) O |=o
- , l =I;
- return
- O ; }
-
-